using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.ObjectBuilder;
using Microsoft.Practices.CompositeWeb;
using System.Transactions;
using GC2.Entities.Admin;
using GC2.ExceptionHandler.Services;
using GC2.DataAccess.DAAdmin;

namespace GC2.Bussines.BMAdmin
{
    public class BMSolicitudes
    {
        public BMSolicitudes(string coneccion)
        {
            this.Connection = coneccion;
        }

        private string connection = "";
        public string Connection
        {
            get { return connection; }
            set { connection = value; }
        }

        private Solicitudes oSoliciutd = new Solicitudes();
        private List<Solicitudes> listSolicitudes = new List<Solicitudes>();
        private DASolicitudes daSolicitudes = new DASolicitudes();

        #region BMSolicitudesSearch
        public List<Solicitudes> BMSolicitudesSearch(Solicitudes solicitud, Solicitudes solicitud2)
        {
            try
            {
                listSolicitudes = daSolicitudes.DASolicitudesSearch(connection, solicitud, solicitud2);
                return listSolicitudes;
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region BMSolicitudesInsert
        public Solicitudes BMSolicitudesInsert(Solicitudes solicitud)
        {
            try
            {
                solicitud = daSolicitudes.DASolicitudesInsert(connection, solicitud);
                return solicitud;
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region BMSolicitudesUpdate
        public void BMSolicitudesUpdate(Solicitudes solicitud)
        {
            try
            {
                daSolicitudes.DASolicitudesUpdate(connection, solicitud);
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region BMSolicitudesGetOne
        public Solicitudes BMSolicitudesGetOne(Solicitudes solicitud)
        {
            try
            {
                oSoliciutd = daSolicitudes.DASolicitudesGetOne(connection, solicitud);
                return oSoliciutd;
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion
    }
}
